﻿<%@ Page Title="" Language="C#" MasterPageFile="~/ReportsAndStatistics/ReportsAndStatisticsPages.master" AutoEventWireup="true" CodeBehind="ReportByProductTypes.aspx.cs" Inherits="WebApp.ReportsAndStatistics.ReportByProductTypes" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="scriptCssContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            $("#<%= btnReport.ClientID %>").click(function () {
                try {
                    var rdpReportDateFrom = $find("<%= rdpReportDateFrom.ClientID %>");
                    var rdpReportDateTo = $find("<%= rdpReportDateTo.ClientID %>");

                    if (!CheckRequireField(rdpReportDateFrom, "Vui lòng chọn thống kê từ ngày!", 3, true)) {
                        return false;
                    }
                    if (!CheckRequireField(rdpReportDateTo, "Vui lòng chọn thống kê đến ngày!", 3, true)) {
                        return false;
                    }

                    return true;
                } catch (e) {
                    alert(e);
                    return false;
                }
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="contentPlaceHolder" runat="server">
    <h3 style="text-align:center;">THỐNG KÊ DOANH SỐ SỬA CHỬA THEO LOẠI SẢN PHẨM</h3>
    
    <fieldset title="Thông tin thống kê">
        <legend>Thông tin thống kê</legend>
        <table style="width:100%; border:0px;">
            <tr>
                <td class="ISoft_LabelTitle" style="width:15%;">Thống kê từ ngày <span class="ISoft_RequireField">*</span></td>
                <td class="ISoft_Input" style="width:35%;">
                    <telerik:RadDatePicker ID="rdpReportDateFrom" Runat="server" Skin="<%$ Resources:Strings, Skin%>" 
                                            Culture="Vietnamese (Vietnam)" Width="200px">
                        <Calendar ID="Calendar1" runat="server" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" 
                                    ViewSelectorText="x" Skin="<%$ Resources:Strings, Skin%>" >
                        </Calendar>

                        <DatePopupButton ImageUrl="" HoverImageUrl="" ToolTip="Bấm vào đây để chọn ngày."></DatePopupButton>
                        <DateInput ID="DateInput1" runat="server" DisplayDateFormat="dd/MM/yyyy" DateFormat="dd/MM/yyyy" EmptyMessage="Chọn thống kê từ ngày">
                            <ClientEvents OnError="DateError" />
                        </DateInput>
                        <ClientEvents OnDateSelected="DateSelected" />
                    </telerik:RadDatePicker>
                </td>

                <td class="ISoft_LabelTitle" style="width:15%;">đến ngày <span class="ISoft_RequireField">*</span></td>
                <td class="ISoft_Input" style="width:35%;">
                    <telerik:RadDatePicker ID="rdpReportDateTo" Runat="server" Skin="<%$ Resources:Strings, Skin%>" 
                                            Culture="Vietnamese (Vietnam)" Width="200px">
                        <Calendar ID="Calendar2" runat="server" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" 
                                    ViewSelectorText="x" Skin="<%$ Resources:Strings, Skin%>" >
                        </Calendar>

                        <DatePopupButton ImageUrl="" HoverImageUrl="" ToolTip="Bấm vào đây để chọn ngày."></DatePopupButton>
                        <DateInput ID="DateInput2" runat="server" DisplayDateFormat="dd/MM/yyyy" DateFormat="dd/MM/yyyy" EmptyMessage="Chọn thống kê đến ngày">
                            <ClientEvents OnError="DateError" />
                        </DateInput>
                        <ClientEvents OnDateSelected="DateSelected" />
                    </telerik:RadDatePicker>
                </td>
            </tr>
        </table>
    </fieldset>

    <table style="width:100%; border:0px;">
        <tr>
            <td class="ISoft_ButtonsRow">
                <telerik:RadButton ID="btnReport" runat="server" 
                    Skin="<%$ Resources:Strings, Skin%>" Text="<%$ Resources:Strings, Statistics %>" 
                    Width="100px" onclick="btnReport_Click"></telerik:RadButton>
            </td>
        </tr>

        <tr>
            <td>
                <asp:Repeater runat="server" ID="rptResult" 
                    onitemdatabound="rptResult_ItemDataBound">
                    <HeaderTemplate>
                        <table class="ISoft_Report_Table" cellspacing="0px" cellpadding="0px">
                            <thead>
                                <tr>
                                    <td class="ISoft_Report_td" style="width:5%;" rowspan="2">STT</td>
                                    <td class="ISoft_Report_td" style="width:30%;" rowspan="2">Loại Sản Phẩm</td>
                                    <td class="ISoft_Report_td" style="width:10%;" rowspan="2">Số Lượng</td>
                                    <td class="ISoft_Report_td" colspan="2" style="border-bottom: 1px solid black;">Trong Đó</td>
                                    <td rowspan="2">Tiền Thu Của Khách</td>
                                </tr>

                                <tr>
                                    <td class="ISoft_Report_td" style="width:10%;">Bảo Hành</td>
                                    <td class="ISoft_Report_td" style="width:10%;">Tính Phí</td>
                                </tr>
                            </thead>
                        </table>
                    </HeaderTemplate>

                    <ItemTemplate>
                        <table class="ISoft_Report_Table" cellspacing="0px" cellpadding="0px">
                            <tr>
                                <td class="ISoft_Report_td" style="width:5%; text-align:center;">
                                    <asp:Label runat="server" ID="lblNumberOrder" Text='<%# DataBinder.Eval(Container.DataItem, "NumberOrder") %>'></asp:Label>
                                </td>
                                <td class="ISoft_Report_td" style="width:30%;">
                                    <asp:Label runat="server" ID="lblProductTypeID" Text='<%# DataBinder.Eval(Container.DataItem, "ID") %>' Visible="false"></asp:Label>
                                    <asp:HyperLink runat="server" ID="hplProductTypeName" Text='<%# DataBinder.Eval(Container.DataItem, "ProductTypeName") %>'></asp:HyperLink>
                                </td>
                                <td class="ISoft_Report_td" style="width:10%; text-align:center;">
                                    <asp:Label runat="server" ID="lblQuantity" Text='<%# DataBinder.Eval(Container.DataItem, "Quantity") %>'></asp:Label>
                                </td>
                                <td class="ISoft_Report_td" style="width:10%; text-align:center;">
                                    <asp:Label runat="server" ID="lblWarrantyQuantity" Text='<%# DataBinder.Eval(Container.DataItem, "WarrantyQuantity") %>'></asp:Label>
                                </td>
                                <td class="ISoft_Report_td" style="width:10%; text-align:center;">
                                    <asp:Label runat="server" ID="lblNoWarrantyQuantity" Text='<%# DataBinder.Eval(Container.DataItem, "NoWarrantyQuantity") %>'></asp:Label>
                                </td>
                                <td style="text-align:right;">
                                    <asp:Label runat="server" ID="lblCost" Text='<%# DataBinder.Eval(Container.DataItem, "Cost") %>'></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </asp:Repeater>
                <table class="ISoft_Report_Table" cellspacing="0px" cellpadding="0px">
                    <tr>
                        <td class="ISoft_Report_td ISoft_TotalItem" style="width:35%; text-align:center;">Tổng Cộng</td>
                        <td class="ISoft_Report_td ISoft_TotalItem" style="width:10%; text-align:center;">
                            <asp:Label runat="server" ID="lblTotalQuantity" Text=""></asp:Label>
                        </td>
                        <td class="ISoft_Report_td ISoft_TotalItem" style="width:10%; text-align:center;">
                            <asp:Label runat="server" ID="lblTotalWarrantyQuantity" Text=""></asp:Label>
                        </td>
                        <td class="ISoft_Report_td ISoft_TotalItem" style="width:10%; text-align:center;">
                            <asp:Label runat="server" ID="lblTotalNoWarrantyQuantity" Text=""></asp:Label>
                        </td>
                        <td class="ISoft_TotalItem" style="text-align:right;">
                            <asp:Label runat="server" ID="lblTotalCost" Text=""></asp:Label>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</asp:Content>
